package com.test.langchain4j.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @description:
 * @author: liuziyang
 * @since: 2025/7/30 11:38
 * @modifiedBy:
 * @version: 1.0
 */
@Slf4j
@RestController
public class PopularIntegrationController {
  @Resource private ChatModel chatModel;

  @GetMapping(value = "/lc4j/boot/chat")
  public String chat(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt) {
    String result = chatModel.chat(prompt);
    log.info("Qwen问答结果: {}", result);
    return result;
  }
}
